<template>
	<view>
		<view class="box">
			<u-gap></u-gap>
			<view class="bg-white h-60 ">
				<div class="flex "  style="justify-content: center;">
					<!-- <h2 class="">问诊医生卡片</h2> -->
				</div>
				<div class="flexflex mx-20	 flex-between p-5"  style="align-items: center;" v-if="interrogationInfo">
					<div class="left flex-col">
						<div class="name text-xl my-2 size_18">
							{{interrogationInfo.uname || '1312'}}
						</div>
						<div class=" textColor text-sm my-2">
							{{interrogationInfo.titlename || '1312'}} 
						</div>
						<div class=" textColor text-sm my-2">
							{{interrogationInfo.deptname || '1312'}} 
						</div>
						<div class=" textColor text-sm my-2">
							{{interrogationInfo.subjectname || '1312'}} 
						</div>
						<div class=" textColor text-sm my-2">
							{{interrogationInfo.ucompname || '1312'}} 
						</div>
					</div>
					<div class="right flex-col textColor text-sm " style="text-align: right;">
						<div class="status">
							<view class="demo-layout bg-purple-light">
								<view class="size_14  uni-text-gray" v-if="interrogationInfo.status == '0'">
									{{ '待接诊' }}
								</view>
								<view class="size_14  text-blue" v-if="interrogationInfo.status == '1'">
									{{ '问诊中' }}
								</view>
								<view class="size_14 text-yellow" v-if="interrogationInfo.status == '3'">
									{{ '已完成' }}
								</view>
							</view>
						</div>
						<div class="time">
							<!-- {{ $u.timeFormat(interrogationInfo.createTime, 'yyyy年mm月dd日')}} -->
							{{renderTime(interrogationInfo.createTime)}}
						</div>
					</div>
				</div>
				<u-gap></u-gap>
			</view>
			<u-gap></u-gap>
			
			<view v-if="interrogationInfo">
				<uni-card title="问诊人卡片" :is-shadow='true' :isFull="true"
					:sub-title="interrogationInfo.cccc || '小明'" :extra="Relationship">
					<text class="size_14" style="letter-spacing: 10rpx;line-height: 24rpx;">
						{{interrogationInfo.diseaseDescription}}
					</text>
				</uni-card>
			</view>
			<u-gap></u-gap>
			
			<view class="w-full h-full" v-if="!interrogationInfo" style=" display: flex;justify-content: center;">
				"暂无数据"
			</view>
			<!--  -->
		</view>
	</view>
</template>

<script>
	export default {
		methods: {
			async getList() {
				let re = await this.$API.orderApi.myorderDetail(this.interrogationPersonInfo.orderNo)
				this.interrogationInfo = {...this.interrogationInfo,...re}
			},
			async getListPatients() {
				/*  */
				let data = {
					consultationOrderId: this.interrogationPersonInfo.consultationOrderId
				}
				let re = await this.$API.orderApi.PatientsDetail(data)
				this.interrogationInfo.cccc =  re.xtName
				this.interrogationInfo.xtRelationship =  re.xtRelationship
			},
			 renderTime(date) {
			        var dateee = new Date(date).toJSON();
			        return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')

			}
		},
		onLoad(options) {
			if (options.data) {
				let jsondata = JSON.parse(options.data)
				this.interrogationPersonInfo = jsondata
				this.interrogationInfo = {...this.interrogationPersonInfo,...this.interrogationInfo}
				/*  */
				setTimeout(()=>{
					this.getList()
					this.getListPatients()
				})
			}
		},
		data() {
			return {
				interrogationPersonInfo: {},
				interrogationInfo: ''
			};
		},
		computed:{
			Relationship(){
				// 关系(0本人，1父母，2兄妹，3儿女，4其他)
				let status = this.interrogationInfo.xtRelationship
				switch (status){
					case "0":
						status = '本人'
						break;
					case "1":
						status = '父母'
						break;
					case "2":
						status = '兄妹'
						break;
					case "3":
						status = '儿女'
						break;
					case "4":
						status = '其他'
						break;
					default:
						break;
				}
				return status
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F7F8FA;
	}

	.textColor {
		color: #AAA9AF;
	}
</style>